<template>
  <div class="tree-container">
        <!-- 这是侧导航 -->
        <tree ref="tree"
          @addcode="addcode"
          @editcode="editcode"
        ></tree>

        <div class="tree-container-right vw4" >
          <!-- 右侧展示-->
          <div class="page-component-wrap animated fadeIn">
            <el-row style="margin:0px;margin-bottom: 10px;">
              <el-col :span="10">
                <el-button type="primary" @click="$refs.codedit.handleCreate()" icon="el-icon-plus">顶级编码</el-button>
              </el-col>
              <el-col :span="14">

                <div class="grid-content bg-purple-dark">
                <!--自动搜索-->
<!--
                  <el-autocomplete
                    v-model="searchText"
                    :fetch-suggestions="querySearchAsync"
                    :debounce="1000"
                    placeholder="内容"
                    @select="handleSelect"
                    size="medium "
                    clearable
                    suffix-icon="el-icon-edit"
                    class="immm"
                  >
                    <template slot-scope="{ item }">
                      <span class="fullCodeNo">{{ item.fullCodeNo }}</span>
                      <span class="fullname">{{ item.fullname }}</span>
                      &lt;!&ndash;<span class="level">{{ item.level }}</span>&ndash;&gt;
                    </template>
                  </el-autocomplete>
-->
                </div>
              </el-col>


            </el-row>
            <!--add/edit-->
            <codeEdit ref="codedit"
                      @appendCode="appendCode"
                      @updateCode="updateCode"
            ></codeEdit>



            <!--list-->

            <!--                  <el-table-column align="left" fixed label="层级名称" prop="fullname" width="200">
                                <template slot-scope="scope"><span>{{scope.row.halfullName}}</span></template>
                              </el-table-column>-->
            <el-row>
              <el-col :span="24">

              </el-col>
            </el-row>

            <!--curd goods-->
          </div>
        </div>

  </div>
</template>
<script>

  import mixinCode from './comp/mixinCode'
  import {fetchGet} from '@/api/common'
  import {disableBtn, df, $err, $suc, ERRS, SUCS, $msg} from '@/utils'
  import codeEdit from './comp/codeEdit' // Secondary package based on el-pagination
  //当前页面引入局部store
  // import scode from '@/store/modules/storeCode'
  // this.$store.registerModule('scode', scode);
  import tree from './comp/treeCode'

  export default {
    name: 'codeCategory',
    inject: ['reload'],
    mixins: [mixinCode],
    created() {
    },
    components: {
      tree,
      codeEdit
    },
    computed: {},
    mounted() {
      // this.allList(0) //根级level select
    },
    data() {
      return {
        searchText: '',
      };
    },
    methods: {
      addcode(node){
        this.$refs.codedit.handleCreate2(node)
      },
      appendCode(child){
        // this.$refs.tree.getList()
        this.$refs.tree.appendCode(child)
      },
      editcode(node){
        this.$refs.codedit.handleUpdate(node)
      },
      updateCode(){
        this.$refs.tree.getList()
      },

    },
  }
</script>

<style lang="scss">
  @import './comp/index.scss';
</style>

